package myJs.api

import japgolly.scalajs.react.extra.Ajax
import myJs.tool.Pojo.ExportData
import shared.pojo.App._
import upickle.default._

/** Created by yz on 10/10/2023
 */
object Predict {

  val baseUrl = s"${Api.apiUrl}/predict"

  def exportPdf(request: ExportPdfData) = {
    val url = s"${baseUrl}/exportById"
    Ajax("POST", s"${url}").setRequestContentTypeJson
                           .send(write(request))
                           .asAsyncCallback
                           .map { xhr =>
                             read[DirData](xhr.responseText)
                           }
  }


}
